import { Controller, Get, Post, Body } from '@midwayjs/decorator';
import { BookService } from '../service/book.service';
import { Book } from '../entity/book';
import { Inject } from '@midwayjs/core';

@Controller('/api/books')
export class BookController {
  @Inject()
  bookService: BookService;

  @Get('/')
  async getBooks() {
    return this.bookService.getBooks();
  }

  @Post('/')
  async addBook(@Body() book: Book) {
    return this.bookService.addBook(book);
  }

  // 其他路由...
}